<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="rss_feed_publisher">
<table class="rss_feed_publisher_table">
		<tr>
			<th>RSS Feed Title</th>
			<th>RSS Feed Link</th>
			<th>RSS Feed Description</th>
			<th>Action</th>
		</tr>
	<c:forEach var="lemonFeed" items="${lemonFeedList }">
		<tr>
 		   <td>${lemonFeed.title }</td>
 		   <td><a href="${lemonFeed.link }" target="_blank">${lemonFeed.link }</a></td>
 		   <td>${lemonFeed.description }</td>
 		   <td>
 		   		<a href="javascript:void(0)" lemonFeedId="${lemonFeed.id }" rssUrl="${lemonFeed.link }" class="lemonFeedEdit">Edit&nbsp;&nbsp;</a>
 		   		<a href="javascript:void(0)" lemonFeedId="${lemonFeed.id }" rssUrl="${lemonFeed.link }" class="lemonFeedDelete">Delete</a>
 		   </td>
		</tr>
	</c:forEach>
</table>
<div class="status"></div>
</div>
<script type="text/javascript">
<!--
$(function(){
	$('.lemonFeedEdit').click(function(){});	
	$('.lemonFeedDelete').click(function(){
		var $lemonFeedDelete = $(this);
		var $status = $(".rss_feed_publisher .status");
		var $rss_feed_publisher = $('.rss_feed_publisher');
		$status.empty();
		$rss_feed_publisher.mask('Loading...');
		$.ajax({
			   type: "POST",
			   url: "${ctx}/goal/rssReader!deleteRSSFeed.action",
			   data: "rssFeedId="+ $lemonFeedDelete.attr('lemonFeedId') + '&rssUrl='+ $lemonFeedDelete.attr('rssUrl'),
			   dataType: "json",
			   success: function(json){
				   if(json['status'] == 'S'){
					  	 $lemonFeedDelete.parents('tr').remove();
					  	$status.text("Delete Data Successfully!");
				   }else{
					   $status.text("Delete Data Unsuccessfully, please try it again!");
				   }
				   $rss_feed_publisher.unmask();
			   }
			});
	});
	
});
//-->
</script>
